package algorithm;

public class leetcode_0027 {
    public int removeElement(int[] nums, int val) {
        int current=0;
        int tem;
        if(nums==null) return 0;
        int len=nums.length;
        for(int i=len-1;i>=0;i--){
            if(nums[i]==val){
                tem=nums[len-1-current];
                nums[len-1-current]=val;
                nums[i]=tem;current++;
            }
        }
        return len-current;
    }
}
